package com.zychowaniec.opengl;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.Environment;
import android.view.MotionEvent;

import com.wavefront.Model;
import com.zychowaniec.opengl.util.SystemUiHider;

/**
 * An example full-screen activity that shows and hides the system UI (i.e.
 * status bar and navigation/system bar) with user interaction.
 * 
 * @see SystemUiHider
 */
public class FullscreenActivity extends Activity {

		   private GLSurfaceView glView;   // Use GLSurfaceView
		   private OGLRenderer mRenderer;
		   // Call back when the activity is started, to initialize the view
		   @Override
		   protected void onCreate(Bundle savedInstanceState) {
			  
			  Model model = new Model();
			  model.load(Environment.getExternalStorageDirectory().getPath()+"/untitled.obj");
			  model.printStatistic();
		      super.onCreate(savedInstanceState);
		      glView = new GLSurfaceView(this);           // Allocate a GLSurfaceView
		      mRenderer = new OGLRenderer(this);
		      glView.setRenderer(mRenderer); // Use a custom renderer
		      this.setContentView(glView);                // This activity sets to GLSurfaceView
		   }
		   
		   // Call back when the activity is going into the background
		   @Override
		   protected void onPause() {
		      super.onPause();
		      glView.onPause();
		   }
		   
		   // Call back after onPause()
		   @Override
		   protected void onResume() {
		      super.onResume();
		      glView.onResume();
		   }
		   
		   public boolean onTouchEvent(MotionEvent event) {
			     return mRenderer.onTouchEvent(event); 
			   }
}
